﻿@model System.Collections.Generic.IEnumerable<Kooboo.CMS.Content.Models.TextFolder>
@{
    ViewBag.Title = "Text content".Localize();
    Layout = "~/Views/Shared/Site.cshtml";
    TextFolder currentFolder = null;
    if (!string.IsNullOrEmpty(ViewContext.RequestContext.GetRequestValue("FolderName")))
    {
        currentFolder = new TextFolder(Repository.Current, ViewContext.RequestContext.GetRequestValue("FolderName")).AsActual();
    }
}

@section Panel{
    <ul class="panel">
        @if (Kooboo.CMS.Web.Authorizations.AuthorizationHelpers.Authorize(ViewContext.RequestContext, Kooboo.CMS.Account.Models.Permission.Contents_FolderPermission))
        {
            <li>
                <a href="@Url.Action("Create", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))">
                    @Html.IconImage("add-folder") @("New folder".Localize())
                </a>
            </li>

            <li>
                <a href="@Url.Action("Delete", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-show-on-check="Any" data-command-type="AjaxPost" data-confirm="@("Are you sure you want to delete these items?".Localize())">
                    @Html.IconImage("delete") @("Delete".Localize())
                </a>
            </li>
            <li class="j_DropDown" data-show-on-check="Any">
                <a>
                    @("More...".Localize())
                    @Html.IconImage("arrow small white-down")
                </a>
                <ul class="j_DropDownContent hide">
                    <li>
                        <a href="@Url.Action("Edit", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-show-on-check="Single" data-command-type="Redirect">
                            @("Settings".Localize())
                        </a>
                    </li>
                    <li><a href="@Url.Action("Relations", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl).Merge("title", "Show folder relations"))" data-show-on-check="Single" data-command-type="Redirect">@("Relations".Localize())</a></li>
                </ul>
            </li>

        }
        @foreach (var group in Kooboo.CMS.Sites.Extension.UI.TopToolbar.ToolbarButtons.GetToolbarButtons(ViewContext.RequestContext))
        {
            @Html.Partial("_ToolbarGroupButtons", group)
        }
    </ul>
}
<div class="topbar clearfix">
    <h1 class="title">
        @if (currentFolder == null)
        {
            @ViewBag.Title
        }
        else
        {
            @currentFolder.FriendlyText
        }
    </h1>
    @Html.Partial("_TextContentGridBreadcrumb", currentFolder, new ViewDataDictionary())
    @Html.Partial("_Search")
</div>
@Html.GridForModel2()